﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<DVSProject.Models.AccessModels>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    MWWDISPENSER
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type ="text/javascript">
        $(function () {
            var pointMWWDispenserRemarkI = parseInt($('#ConditionRemarkPointI').val());

            TotalPoint();
            GetMWWDispenserRemarkI(false, pointMWWDispenserRemarkI);

            $('#ConditionProbeCheckI').change(function () {
                var isChecked = $('#ConditionProbeCheckI:checked').val() ? true : false;
                if (isChecked) {
                    pointMWWDispenserRemarkI -= 1;
                } else {
                    pointMWWDispenserRemarkI += 1;
                }
                $('#ConditionRemarkPointI').val(pointMWWDispenserRemarkI);
                TotalPoint();

                if (pointMWWDispenserRemarkI == 3) {
                    GetMWWDispenserRemarkI(false, pointMWWDispenserRemarkI);
                } else {
                    GetMWWDispenserRemarkI(true, pointMWWDispenserRemarkI);
                }
            });

            $('#ConditionDettubeCheckI').change(function () {
                var isChecked = $('#ConditionDettubeCheckI:checked').val() ? true : false;
                if (isChecked) {
                    pointMWWDispenserRemarkI -= 1;
                } else {
                    pointMWWDispenserRemarkI += 1;
                }
                $('#ConditionRemarkPointI').val(pointMWWDispenserRemarkI);
                TotalPoint();

                if (pointMWWDispenserRemarkI == 3) {
                    GetMWWDispenserRemarkI(false, pointMWWDispenserRemarkI);
                } else {
                    GetMWWDispenserRemarkI(true, pointMWWDispenserRemarkI);
                }
            });

            $('#ConditionRinsetubeCheckI').change(function () {
                var isChecked = $('#ConditionRinsetubeCheckI:checked').val() ? true : false;
                if (isChecked) {
                    pointMWWDispenserRemarkI -= 1;
                } else {
                    pointMWWDispenserRemarkI += 1;
                }
                $('#ConditionRemarkPointI').val(pointMWWDispenserRemarkI);
                TotalPoint();

                if (pointMWWDispenserRemarkI == 3) {
                    GetMWWDispenserRemarkI(false, pointMWWDispenserRemarkI);
                } else {
                    GetMWWDispenserRemarkI(true, pointMWWDispenserRemarkI);
                }
            });

            function TotalPoint() {
                $("#TotalPoint").val(parseInt(pointMWWDispenserRemarkI));
            }

            function GetMWWDispenserRemarkI(isFilter, point) {
                var actionUrl = '<%=Url.Action("MWWDispenserRemarkIProcess","Access") %>'
                $.ajax({
                    type: "GET",
                    url: actionUrl,
                    contentType: "application/json; charset=utf-8",
                    data: ({ isFitter: isFilter }),
                    success: function (data) {

                        $("#MWWDispenserRemarkI").html(data);

                        if (point < 3) {
                            $('#ConditionRemarkI').removeAttr("disabled");
                        }
                    },
                    error: function (data) {
                        alert(data);
                        //SimilarSlider.html("<div style='color:#682929;text-align:center;font-weight:bold;'>¢Íâ·É¤èÐ ÃÐººäÁèÊÒÁÒÃ¶áÊ´§Ë¹éÒ¹Õéä´éã¹¢³Ð¹Õé</div>");
                    }
                });
            }
        });
    </script>
    <h2>
        MWW DISPENSER</h2>
    <% using (Html.BeginForm())
       {%>
    <%= Html.ValidationSummary(true) %>
    <div class="CSSTableGenerator">
        <table>
            <tr>
                <th>
                    <label>
                        MWW DISPENSER</label>
                </th>
                <th>
                    <label>
                        Probe ผิดปกติ</label>
                </th>
                <th>
                    <label>
                        Det tube ท่อจ่ายน้ำยาล้างจาน ผิดปกติ</label>
                </th>
                <th>
                    <label>
                        Rinse tube ท่อจ่ายน้ำยาเคลือบแห้ง ผิดปกติ</label>
                </th>
                <th>
                    <label>
                        Conditon/สภาพทั่วไป</label>
                </th>
                <th>
                    <label>
                        Point คะแนน</label>
                </th>
            </tr>
            <tr>
                <td>
                       <%=Html.DropDownListFor(model => model.ConditionMachineI, new SelectList(
                  new List<Object>{ 
                       new { value = "Feeder Buitin (AH-2 ,B-2 ,M2 )" , text = "Feeder Buitin (AH-2 ,B-2 ,M2 )"  },
                       new { value = "Fedder D3020" , text = "Fedder D3020" }

                    },
                  "value",
                  "text",
                                              "Feeder Buitin (AH-2 ,B-2 ,M2 )"))%>

                </td>
                <td align="center">
                    <%= Html.CheckBoxFor(model => model.ConditionProbeCheckI)%>
                </td>
                <td align="center">
                    <%= Html.CheckBoxFor(model => model.ConditionDettubeCheckI)%>
                </td>
                <td align="center">
                    <%= Html.CheckBoxFor(model => model.ConditionRinsetubeCheckI)%>
                </td>
                <td>
                    <%--<%=@Html.DropDownListFor(model => model.ConditionRemarkI, Model.ConditionRemarkISelect)%>--%>
                     <div id="MWWDispenserRemarkI">
                    </div>
                </td>
                <td align="center">
                    <%=@Html.TextBoxFor(model=>model.ConditionRemarkPointI,new{@Value="3",@readonly="true"}) %>
                    
                </td>

            </tr>
            <tr>
                <td colspan="5">
                    Total Points คะแนนรวม
                </td>
                <td>
                    <input type="text" id="TotalPoint" readonly="readonly" value="0" />
                </td>
            </tr>
        </table>
    </div>
    <p>
        <input type="submit" class="buttonSummit" value="Next" />
    </p>
    <% } %>
    <div>
        <%= Html.ActionLink("Back to List", "Index") %>
    </div>
</asp:Content>
